<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.js"></script>
    <title>初识Jquery</title>
    <style>
        div {
            width: 100px;
            height: 100px;
            border: 1px solid black;
        }
    </style>

</head>

<body>
    <div></div>
    <div class="box1"></div>
    <div id="box2"></div>
</body>
<script>
    window.onload = function() {
        //js操作 查找dom元素
        //操作属性
        function js() {
            var div1 = document.getElementsByTagName("div")[0];
            var div2 = document.getElementsByClassName("box1")[0];
            var div3 = document.getElementById("box2");
            div1.style.backgroundColor = "red";
            div2.style.backgroundColor = "black";
            div3.style.backgroundColor = "cyan";
        }
        // js();

        $(function() {
            var b1 = $("div");
            var b2 = $(".box1");
            var b3 = $("#box2");
            b1.css({
                background: "yellowgreen",
                width: "200px",
            });
            b2.css({
                background: "orangered"
            });
            b3.css({
                background: "purple"
            });
        });
    }
</script>

</html>